import { myData } from './myMock';
import Mock from 'mockjs';

Mock.mock('http://localhost:8080/api/aa', {
  name: 'name',
  'age|1-100': 100,
  color: 'color'
});

const mockFunc1 = param => {
  return new Promise((resolve, reject) => {
    if (param > 3) {
      setTimeout(() => {
        resolve(myData);
      }, 5000);
    }
  }).catch(err => {
    console.log(err);
  });
};

mockFunc1(5)
  .then(result => {
    console.log(result);
  })
  .catch(err => {
    console.log(err);
  });

fetch('/api/aa').then(response => {
  console.log(response);
});
